package com.workingpub.commons.datasource.internal;

import javax.sql.XADataSource;

import com.mysql.jdbc.jdbc2.optional.MysqlXADataSource;
import com.workingpub.commons.datasource.DatabaseType;

public class MySqlXADataSourceBuilder extends AbstractXADataSourceBuilder {

	@Override
	public String getDataSourceTypeName() {
		return MysqlXADataSource.class.getName();
	}

	@Override
	protected XADataSource buildXaDatasource(String jdbcUrl, String jdbcUser, String jdbcPassword) {
		MysqlXADataSource xaDataSource = new MysqlXADataSource();
		xaDataSource.setUrl(jdbcUrl);
		xaDataSource.setUser(jdbcUser);
		xaDataSource.setPassword(jdbcPassword);

		return xaDataSource;
	}

	@Override
	public DatabaseType getDatabaseType() {
		return DatabaseType.MySQL;
	}
}
